package model.vos.reprodutivo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "osb_leitegada")
public class ObsLeitegada implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 8313309957609890653L;
	private Long id;
	private Date data;
	private String obs;
	private Leitegada leitegada;

	public ObsLeitegada() {
	}

	public ObsLeitegada(Long id, Date data, String obs, Leitegada leitegada) {
		super();
		this.id = id;
		this.data = data;
		this.obs = obs;
		this.leitegada = leitegada;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id_leitegada", nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "data")
	@Temporal(TemporalType.DATE)
	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	@Column(name = "obs")
	public String getObs() {
		return obs;
	}

	public void setObs(String obs) {
		this.obs = obs;
	}

	@ManyToOne
	@JoinColumn(name = "leitegada_id")
	public Leitegada getLeitegada() {
		return leitegada;
	}

	public void setLeitegada(Leitegada leitegada) {
		this.leitegada = leitegada;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ObsLeitegada other = (ObsLeitegada) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ObsLeitegada [data=" + data + ", obs=" + obs + "]";
	}

}
